package com.hst.capacity.domain.model.response.account;

import com.hst.capacity.domain.model.entity.account.ExDriverAccountDetailEntity;
import com.hst.capacity.domain.model.entity.account.IcDriverAccountDetailEntity;
import com.hst.capacity.domain.model.entity.account.SpecialDriverAccountDetailEntity;
import com.hst.capacity.domain.model.entity.order.express.ExOrderSettlementViewEntity;
import com.hst.capacity.domain.model.entity.order.express.ExpressOrderEntity;
import com.hst.capacity.domain.model.entity.order.express.ExpressOrderSettlementEntity;
import com.hst.capacity.domain.model.entity.order.intercity.IcOrderSettlementViewEntity;
import com.hst.capacity.domain.model.entity.order.intercity.IntercityOrderEntity;
import com.hst.capacity.domain.model.entity.order.intercity.IntercityOrderSettlementEntity;
import com.hst.capacity.domain.model.entity.order.specialcar.SpCarOrderSettlementEntity;
import com.hst.capacity.domain.model.entity.order.specialcar.SpCarOrderSettlementViewEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Alias("driverAccountDetailVO")
public class DriverAccountDetailVO {

    private String idDriver;//司机主键
    private String idOrder;//主键
    private String createBy;//时间
    private String createTime;//时间
    private String bizTypeName;//业务类型|线路名称
    private Integer bizType;//业务类型|线路名称
    private String startAddress;//上车详细地址
    private String dropOffArea;//实际下车详细地址
    private Float orderMoney;//客户应付
    private Float couponDiscount;//优惠折扣金额
    private Float money;//司机实收
    private Float balance;//交易前余额
    private Integer paymentType;//司机实收
    private String idAccountDetail;//主键
    private String idAccount;//主键
    private String relateOrderNo;//主键
    private String relateVoucherNo;//流水号
    private Integer companyType;//主键
    private String memo;
    private String idFranchisee;
    private String relateAccount;
    private Integer statisticsFlag;

    public DriverAccountDetailVO(ExDriverAccountDetailEntity accountDetail
            , ExpressOrderSettlementEntity order
            , ExOrderSettlementViewEntity orderView) {

        if (orderView!=null){
            this.idDriver = orderView.getIdDriver();
            this.bizTypeName = orderView.getOrderBizName();//"站点接驳";
            this.startAddress = orderView.getStartAddress();
            this.dropOffArea = orderView.getDropOffArea();
        }
        this.idOrder = order.getIdOrder();
        //this.createTime = accountDetail.getCreateTime();
        this.orderMoney = order.getOrderMoney();
        this.couponDiscount = order.getOrderCoupon();
        this.money = accountDetail.getMoney();

    }

    public DriverAccountDetailVO(IcDriverAccountDetailEntity accountDetail
            , IntercityOrderSettlementEntity order
            , IcOrderSettlementViewEntity orderView) {

        if (orderView!=null){
            this.idDriver = orderView.getIdDriver();
            this.bizTypeName = orderView.getOrderBizName();//"站点接驳";
            this.startAddress = orderView.getStartAddress();
            this.dropOffArea = orderView.getDropOffArea();
        }
        this.idOrder = order.getIdOrder();
        //this.createTime = accountDetail.getCreateTime();
        this.orderMoney = order.getOrderMoney();
        this.couponDiscount = order.getOrderCoupon();
        this.money = accountDetail.getMoney();

    }

    public DriverAccountDetailVO(SpecialDriverAccountDetailEntity accountDetail
            , SpCarOrderSettlementEntity order
            , SpCarOrderSettlementViewEntity orderView) {

        if (orderView!=null){
            this.idDriver = orderView.getIdDriver();
            this.bizTypeName = orderView.getOrderBizName();//"站点接驳";
            this.startAddress = orderView.getStartAddress();
            this.dropOffArea = orderView.getDropOffArea();
        }
        this.idOrder = order.getIdOrder();
        //this.createTime = accountDetail.getCreateTime();
        this.orderMoney = order.getOrderMoney();
        this.couponDiscount = order.getOrderCoupon();
        this.money = accountDetail.getMoney();

    }

    public DriverAccountDetailVO(ExDriverAccountDetailEntity accountDetail, ExpressOrderEntity order) {
        this.idDriver = order.getIdDriver();
        this.idOrder = order.getIdOrder();
        //this.createTime = accountDetail.getCreateTime();
        this.bizTypeName = "站点接驳";
        this.startAddress = order.getStartAddress();
        this.dropOffArea = order.getDropOffArea();
        this.orderMoney = order.getOrderMoney();
        this.couponDiscount = order.getCouponDiscount();
        this.money = accountDetail.getMoney();
    }

    public DriverAccountDetailVO(IcDriverAccountDetailEntity accountDetail, IntercityOrderEntity order) {
        this.idDriver = order.getIdDriver();
        this.idOrder = order.getIdOrder();
        //this.createTime = accountDetail.getCreateTime();
        this.bizTypeName = "站点接驳";
        this.startAddress = order.getStartAddress();
        this.dropOffArea = order.getDropOffArea();
        this.orderMoney = order.getOrderMoney();
        this.couponDiscount = order.getCouponDiscount();
        this.money = accountDetail.getMoney();
    }

}
